package com.ithema.dao;



import com.itheima.domain.Book;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;


import java.util.List;


@Repository
public interface BookMapper {

//    增
    @Insert("insert into tbl_book values(null,#{type},#{name},#{description})")
    int saveBook(Book book);

//    删除
    @Delete("DELETE FROM tbl_book where id=#{id};")
    int deleteBook(@Param("id") Integer id);

    //改
    @Update("update tbl_book set type=#{type},name=#{name},description=#{description} where id=#{id}")
    int update(Book book);

    //查
    @Select("select *from tbl_book")
    List<Book> selectBookAll();//查全部

    @Select("select *from tbl_book where tbl_book.id=#{id}")
    Book selectBook_Id(Integer id);//查单个
}
